package com.stack;

import org.junit.Before;
import org.junit.Test;

import static org.junit.Assert.*;

/**
 * @Author: linKe
 * @Date: 2022/1/1 19:47
 * @FileName: SeqStackTest
 * @version: 1.0
 * @Description: 描述
 */
public class SeqStackTest {

    private SeqStack<Integer> stack;

    @Before
    public void setUp() throws Exception {
        stack = new SeqStack<>(12);
        stack.push(1);
        stack.push(2);
        stack.push(3);
    }

    @Test
    public void isEmpty() {
        boolean empty = stack.isEmpty();
        System.out.println(empty);
        // false
    }

    @Test
    public void push() {
        stack.push(4);
        Integer peek = stack.peek();
        System.out.println(peek);
        // 4
    }

    @Test
    public void peek() {
        Integer peek = stack.peek();
        System.out.println(peek);
        // 3
    }

    @Test
    public void pop() {
        Integer pop = stack.pop();
        System.out.println(pop);
        // 3 弹出后栈顶的元素
    }

    @Test
    public void testToString() {
        System.out.println(stack.toString());
        //com.stack.SeqStack,com.linearList.SeqList(1,2,3)
    }
}